/*
 * trunk/test_dev_driver.c
 *
 * Harry Wei <harryxiyou@gmail.com> 2012 (C)
 */
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>

#define LEN		(16)

int main(int argc, char **argv) {
	int testdev = 0;
	int i = 0;
	int ret = 0;
	char buf[LEN];

	memset(buf, '\0', LEN);
	testdev = open("/dev/mycdev1", O_RDWR);
	if (-1 == testdev) {
		printf("cannot open dev file...\n");
		exit(1);
	}
	if ((ret = read(testdev, buf, LEN)) < LEN) {
		printf("read error!..\n");
		exit(1);
	}
	for (i = 0; i < LEN; i++) {
		printf("%c ", buf[i]);
	}
	close(testdev);
	return 0;
}
